package com.hdu.controller.contentManagement;

import com.hdu.entity.CourseTeacher;
import com.hdu.pojo.Result;
import com.hdu.service.ICourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/courseTeacher")
@Api(value = "教师信息相关接口", tags = "教师信息相关接口")
public class CourseTeacherController {

    private final ICourseTeacherService courseTeacherService;

    @ApiOperation("查询教师信息接口")
    @GetMapping("/list/{courseId}")
    public Result<CourseTeacher> getCourseTeacherList(@PathVariable Long courseId) {
        return Result.success(courseTeacherService.getCourseTeacherList(courseId));
    }

    @ApiOperation("添加/修改教师信息接口")
    @PostMapping
    public Result<CourseTeacher> saveCourseTeacher(@RequestBody CourseTeacher courseTeacher) {
        return Result.success(courseTeacherService.saveCourseTeacher(courseTeacher));
    }

    @ApiOperation("删除教师信息接口")
    @DeleteMapping("/course/{courseId}/{teacherId}")
    public void deleteCourseTeacher(@PathVariable Long courseId, @PathVariable Long teacherId) {
        courseTeacherService.deleteCourseTeacher(courseId,teacherId);
    }
}
